#pragma once
#include "public.h"
#include "elf.h"
#include <map>
#include <string>
#include <vector>
#include "config.h"
class ELFReader;
class Module;
class VirtualNDK;




class Modules
{
public:
	Modules(VirtualNDK* vndk);
	~Modules();

private:
	VirtualNDK* vndk;
	uint64_t load_bias_;
	uint64_t base_addr;
	size_t load_size_;
	std::map<std::string, uint64_t> symbol_hooks;
	std::map<std::string, SymbolResolved> symbols_resolved;
	std::vector<Module*> modules;
public:
	Module* load_module(char* filenme);
	int Relocate(ELFReader& elf,ElfW(Rel)* rel, unsigned count);
	ElfW(Addr) resolve_symbol_address(ElfW(Sym)* s);
	uint64_t _elf_get_symval(ELFReader& elf, ElfW(Sym)* symbol);
	uint64_t _elf_lookup_symbol(std::string name);
	void add_symbol_hook(std::string symbol_name, uint64_t addr);
};

